package com.ruoyi.stock.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.stock.mapper.KProductInStockMapper;
import com.ruoyi.stock.domain.KProductInStock;
import com.ruoyi.stock.service.IKProductInStockService;

/**
 * 商品入库Service业务层处理
 * 
 * @author lb
 * @date 2024-01-31
 */
@Service
public class KProductInStockServiceImpl implements IKProductInStockService 
{
    @Autowired
    private KProductInStockMapper kProductInStockMapper;

    /**
     * 查询商品入库
     * 
     * @param id 商品入库主键
     * @return 商品入库
     */
    @Override
    public KProductInStock selectKProductInStockById(Long id)
    {
        return kProductInStockMapper.selectKProductInStockById(id);
    }

    /**
     * 查询商品入库列表
     * 
     * @param kProductInStock 商品入库
     * @return 商品入库
     */
    @Override
    public List<KProductInStock> selectKProductInStockList(KProductInStock kProductInStock)
    {
        return kProductInStockMapper.selectKProductInStockList(kProductInStock);
    }

    /**
     * 新增商品入库
     * 
     * @param kProductInStock 商品入库
     * @return 结果
     */
    @Override
    public int insertKProductInStock(KProductInStock kProductInStock)
    {
        kProductInStock.setCreateBy(SecurityUtils.getUsername());
        kProductInStock.setCreateTime(DateUtils.getNowDate());
        return kProductInStockMapper.insertKProductInStock(kProductInStock);
    }

    /**
     * 修改商品入库
     * 
     * @param kProductInStock 商品入库
     * @return 结果
     */
    @Override
    public int updateKProductInStock(KProductInStock kProductInStock)
    {
        return kProductInStockMapper.updateKProductInStock(kProductInStock);
    }

    /**
     * 批量删除商品入库
     * 
     * @param ids 需要删除的商品入库主键
     * @return 结果
     */
    @Override
    public int deleteKProductInStockByIds(Long[] ids)
    {
        return kProductInStockMapper.deleteKProductInStockByIds(ids);
    }

    /**
     * 删除商品入库信息
     * 
     * @param id 商品入库主键
     * @return 结果
     */
    @Override
    public int deleteKProductInStockById(Long id)
    {
        return kProductInStockMapper.deleteKProductInStockById(id);
    }
}
